<?php
    
    use think\Route;
    
    //定义路由
//    Route::get("/" , function (){
//        return "Hello , world";
//    });
   

//   Route::rule("new/:id" , "index/News/read");
   
//    Route::rule(['new' , 'new/:id'] , 'index/News/read');
    
//    Route::rule("new/:id" , "News/update" , 'post');

    //定义文章相关的路由
    //增加文章
//Route::post("news" , "index/News/add");
////删除文章
//Route::delete("news/:id" , "index/News/delete");
////修改文章
//Route::put("news/:id" , "index/News/update");
////查询文章
//Route::get("news/:id" , "index/News/read");
//Route::rule("news/:id" , "News/read" , "GET|POST");

//Route::rule([
//    'news/:id' => 'index/News/read',
//    'goods/:id' => 'index/Goods/goodFind'
//]);

    //快速过一遍   不要深陷其中 这就是规则  咱只需要遵守就行了
//Route::rule(['goods/:id/[:status]' => 'index/Goods/goodFind']);

//当开启完全匹配的时候,如果个别路由不需要使用完整匹配,可以添加路由参数覆盖定义
//Route::rule("news/:id" , "index/News/read" , 'GET|POST' , ['complete_match' => false]);

//这种方式的写法是有点复杂  但是如果想使用的话 照着写就行了
//Route::rule([
//    'news/:id' => 'index/News/read',
//    'goods/:id' => ['Goods/goodFind' , ['ext' => 'shtml'] , ['id' => '\d{1,4}']]
//] , '' , 'GET|POST' , ['ext' => 'html'] , ['id' => '\d+']);

//批量注册GET路由
//Route::get([
//    'news/:id' => "index/News/read",
//    "goods/:id" => ['Goods/goodFind' ,[] , ['id' => '\d+']]
//]);
//
//Route::rule([
//    'news/:id' => "index/News/read",
//    "goods/:id" => ['Goods/goodFind' ,[] , ['id' => '\d+']]
//] , '' , 'get');


 //定义路由配置文件
//return [
//    'news/:id' => 'index/News/read',
//    'goods/:id' => ['index/Goods/goodFind' , ['method' => 'get'] , ['id' => '\d+']]
//];


   
